/*
 * @Author: zh
 * @Date: 2024-12-06 13:48:16
 * @LastEditors: zh
 * @LastEditTime: 2024-12-06 13:53:51
 * @Description: 
 */
import Unoss from 'unocss/vite';
import { type UserConfig } from 'vite';

const commonConfig: (mode: string) => UserConfig = (mode) => ({
    server: {
        host: true,
    },
    esbuild: {
        drop: mode === 'production' ? ['console', 'debugger'] : []
    },
    build: {
        reportCompressedSize: false,
        chunkSizeWarningLimit: 1500,
        rollupOptions: {
            // TODO: Prevent memory overflow
            maxParallelFileOps: 3,
        }
    },
    plugins: [Unoss()]
})
export { commonConfig }